package net.searchdata.study;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

public class Entry23 {
	@Test
	public void test1() {
		List list = new ArrayList();

		list.add(3);
		list.add(4);
		list.add(5);

		int result = 0;
		for (int i = 0; i < list.size(); i++) {
			result += ((Integer) list.get(i)).intValue();
		}

		assertThat(result, is(12));
	}

	private void unsafeAdd(List list) {
		list.add("111");
	}

	@Test
	public void test2() {
		List<Integer> list = new ArrayList<Integer>();
		unsafeAdd(list);
		System.out.println(list.get(0));
	}
}